extends "../ib.gd"
#根据等级增加属性
func addatt():
	att.cri += 0.05
	att.atk += 20
	att.spd += 0.4

#链接信号
func _connect():
	._connect()
	yield(sys.get_tree().create_timer(0.1),"timeout")
	if !masCha:return
	if !masCha.is_connected("onAddItem",self,"check"):
		#print(1)
		masCha.connect("onAddItem",self,"check")

#判断是否升级及是否只有一个望远镜
func check(item):
	yield(sys.get_tree().create_timer(0.02),"timeout")
	if item.id.find("scope") != -1 && item != self:
		if !item:return
		masCha.delItem(item)
		sys.newBaseMsg("提示","一个角色只能装备一个望远镜")
#进化装备
func upgradeself(item):
	var chose = item.chose
	var c = str(chose)
	var upid = str(sys.rndRan(1,3))
	upid = upid + "_Hide_MAX"
	upid = self.id + upid
	self.switchchose(chose)
	var nitem = sys.newItem(upid)
	sys.main.player.addItem(nitem)
	masCha.disconnect("onAddItem",self,"check")
	masCha.addItem(nitem)
	nitem.inheritatt(nitem,self)
	nitem.addatt()
	nitem.upinfo()
	self.delself()